import { defHttp } from '/@/utils/http/axios';
import { CarListGetResultModel, CarParams } from '../model/car';

enum Api {
  Cars = 'cars',
  Car = 'car',
}

/**
 * @description: Get car list value
 */

export const carsApi = (params: CarParams) =>
  defHttp.request<CarListGetResultModel>(
    {
      url: Api.Cars,
      method: 'GET',
      params,
    },
    {
      errorMessageMode: 'modal',
    }
  );

export const createCarsApi = () => {
  defHttp.request(
    {
      url: Api.Car,
      method: 'POST',
    },
    {
      errorMessageMode: 'modal',
    }
  );
};
